﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using UI.Comm.Controls;
using PersonalHealth.Data.Model;
using System.IO;

namespace HealthManagement.Views
{
    /// <summary>
    /// EcgForm.xaml 的交互逻辑
    /// </summary>
    public partial class EcgForm : PMWindow
    {
        EcgFormPage wbo;
        public EcgForm(Measure_ECG obj)
        {
            InitializeComponent();
            this.Unloaded += new RoutedEventHandler(EcgForm_Unloaded);
            wbo = new EcgFormPage(resultStepGrid);
            Image wb = wbo.Image;

            var png = PngBitmapDecoder.Create
               (new MemoryStream(obj.EcgDiagram), BitmapCreateOptions.IgnoreImageCache, BitmapCacheOption.None);
            wb.Source = png.Frames[0];

        }

        void EcgForm_Unloaded(object sender, RoutedEventArgs e)
        {
            if (wbo != null)
                wbo.Close();
        }
    }
}
